﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WaterBill.DAL;
using WaterBill.DTO;

namespace WaterBill.BUS
{
    class BUS_Database : DAL_Database
    {
        public void BUS_Database_Dispose()
        {
            try
            {
                DAL_Database_Dispose();
            }
            catch
            {
            }
        }

        public Boolean BUS_Database_Backup(string path)
        {
            try
            {
                if (DAL_Database_Backup(path))
                {
                    return true;
                }
            }
            catch (Exception)
            {
            }
            return false;
        }

        public Boolean BUS_Database_Restore(string path)
        {
            try
            {
                if (DAL_Database_Restore(path))
                {
                    return true;
                }
            }
            catch (Exception)
            {
            }
            return false;
        }

        public Boolean BUS_Database_checkConnectServer(string ServerName)
        {
            try
            {
                if (DAL_Database_checkConnectServer(ServerName))
                {
                    return true;
                }
            }
            catch
            {
            }
            return false;
        }

        public Boolean BUS_Database_settingConnection(string ServerName, string DatabaseName)
        {
            try
            {
                if (DAL_Database_settingConnection(ServerName, DatabaseName))
                {
                    return true;
                }
            }
            catch
            {
            }
            return false;
        }

        public Boolean BUS_Database_checkExistFileSinfo()
        {
            try
            {
                if (DAL_Database_checkExistFileSinfo())
                {
                    return true;
                }
            }
            catch
            {
            }
            return false;
        }

        public Boolean BUS_Database_checkNotExistDatabase(string ServerName = null, string DatabaseName = null)
        {
            try
            {
                if (DAL_Database_checkNotExistDatabase(ServerName, DatabaseName))
                {
                    return true;
                }
            }
            catch
            {
            }
            return false;
        }

        public List<DTO_InfoConnect> BUS_Database_GetListServer()
        {
            List<DTO_InfoConnect> InfoConnect = new List<DTO_InfoConnect>();
            try
            {
                InfoConnect = DAL_Database_GetListServer();
            }
            catch
            {
            }
            return InfoConnect;
        }

        public List<DTO_InfoConnect> BUS_Database_GetListDatabase(string ServerName)
        {
            List<DTO_InfoConnect> InfoConnect = new List<DTO_InfoConnect>();
            try
            {
                InfoConnect = DAL_Database_GetListDatabase(ServerName);
            }
            catch
            {
            }
            return InfoConnect;
        }
    }
}
